package com.debao;

import com.debao.common.annotation.Anonymous;
import com.debao.common.constant.Constants;
import com.debao.common.core.domain.AjaxResult;
import com.debao.system.domain.Goods;
import com.debao.system.domain.vo.GoodsReqVo;
import com.debao.system.service.IGoodsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 商品
 */
@RestController
@RequestMapping("/api/goods")
public class ApiGoods {

    @Resource
    private IGoodsService goodsService;

    /**
     * 商品列表
     * @param vo
     * @return
     */
    @GetMapping("/list")
    @Anonymous
    public AjaxResult coachList(GoodsReqVo vo) {
        return AjaxResult.success(goodsService.selectGoodsList(new Goods().setName(vo.getKeyWord()).setCategory(vo.getCategory()).setStatus(Constants.STATUS_1)));
    }

    /**
     * 商品详情
     * @param id
     * @return
     */
    @GetMapping("/info/{id}")
    @Anonymous
    public AjaxResult coachList(@PathVariable Long id) {
        return AjaxResult.success(goodsService.selectGoodsById(id));
    }


}
